<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false"%>
<html>
<head>
    <title>编辑混合区间</title>
</head>
<body>
<div ng-app="MixEditApp" ng-controller="MixEditCtrl">
    <ui-form key="mixAdd" column="2">
        <input name="id" type="hidden" value="${mixSectionRule.id}"/>
        <ui-form-select-remote
                url="system/supplier/listall"
                label="供货商:"
                name="supplierCode"
                value-name="code"
                text-name="name"
                value="${mixSectionRule.supplier.code}"></ui-form-select-remote>

        <ui-form-select name="direction" label="运单配送类型" value="${mixSectionRule.direction}">
            <option value="">请选择配送类型</option>
            <option value="0">配送</option>
            <option value="1">上门换</option>
            <option value="2">上门退</option>
        </ui-form-select>


        <ui-form-input name="pointLeft" label="左边界数字:" value="${mixSectionRule.valueRange.pointLeft}"></ui-form-input>
        <ui-form-select name="containLeft" label="是否包含左边界:"  value="${mixSectionRule.valueRange.containLeft}">
            <option value="0">否</option>
            <option value="1">是</option>
        </ui-form-select>

        <ui-form-input name="pointRight" label="右边界数字:" value="${mixSectionRule.valueRange.pointRight}"></ui-form-input>
        <ui-form-select name="containRight" label="是否包含右边界:" value="${mixSectionRule.valueRange.containRight}">
            <option value="0">否</option>
            <option value="1">是</option>
        </ui-form-select>

        <ui-form-select name="settlementType" label="结算类型:" value="${mixSectionRule.settlementType}">
            <option value="">请选择结算类型</option>
            <option value="0">自营</option>
            <option value="1">合作站</option>
            <option value="2">合作商</option>
            <option value="3">大型合作商</option>
        </ui-form-select>

        <ui-form-input name="fixWeight" label="固定值:"  value="${mixSectionRule.valueRange.fixWeight}"></ui-form-input>

        <ui-form-input name="firstPiecePrice" label="首件单价:" value="${mixSectionRule.firstPiecePrice}"></ui-form-input>
        <ui-form-input name="secondPiecePrice" label="拖件单价:" value="${mixSectionRule.secondPiecePrice}"></ui-form-input>

    </ui-form>
</div>
<script>
    angular.module('MixEditApp', ['ui.form','ui.tree']);
    angular.module('MixEditApp').controller('MixEditCtrl', function ($scope) {
        $scope.$on('ui.form.submit',function (event,param) {
            $.ajax({
                url:"rule/mix/update",
                type:"post",
                data:param
            }).done(function (result) {
                if(result.code=='0000'){
                    toastr.success("更新成功");
                    if(opener && opener.reloadTable){
                        opener.reloadTable({});
                    }
                    setTimeout(function () {
                        window.close();
                    },1500);
                }else{
                    toastr.error(result.msg);
                }
            }).fail(function (err) {

            });
        })
    });
</script>
</body>
</html>